﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ZYStudios.Filter
{
    public class AdminFilter : FilterAttribute, IAuthorizationFilter
    {
        #region IAuthorizationFilter 成员

        void IAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext)
        {
            var Session=filterContext.HttpContext.Session;

            if (Session["IsAdminLogin"] == null || Session["IsAdminLogin"].ToString().ToUpper() != "TRUE")
            {
                filterContext.Result = new ViewResult()
                {
                    ViewName = "Login"
                };
            }
        }

        #endregion
    }
}